package Vista;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTable;

import javax.swing.WindowConstants;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class ListadoPosiciones extends javax.swing.JFrame {
 private JScrollPane jScrollPane1;
 private JButton btngenerar;
 private JButton btnSalir;
 private JTable tblTablaPosiciones;

 /**
 * Auto-generated main method to display this JFrame
 */
  
 public ListadoPosiciones() {
  super();
  initGUI();
 }
 
 private void initGUI() {
  try {
   setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
   getContentPane().setLayout(null);
   this.setTitle("Listado de Posiciones");
   {
    jScrollPane1 = new JScrollPane();
    getContentPane().add(jScrollPane1);
    jScrollPane1.setBounds(75, 35, 335, 207);
    {
   
    	JTable tblTablaPosiciones = new JTable();
     TableModel tblTablaPosicionesModel = 
      new DefaultTableModel(
        new String[][] { { "One", "Two" }, { "Three", "Four" } },
        new String[] { "Equipo", "JJ", "JG", "JP","DIF." });
     
     tblTablaPosiciones = new JTable();
     TableRowSorter<TableModel> ordernar = new TableRowSorter<TableModel>();//funcion que ordena la tabla
     tblTablaPosiciones.setRowSorter(ordernar);
     
     jScrollPane1.setViewportView(tblTablaPosiciones);
     tblTablaPosiciones.setModel(tblTablaPosicionesModel);
    }
   }
   {
    btnSalir = new JButton();
    getContentPane().add(btnSalir);
    btnSalir.setText("Salir");
    btnSalir.setBounds(327, 266, 93, 23);
   }
   {
	   btngenerar = new JButton();
	   getContentPane().add(btngenerar);
	   btngenerar.setText("Generar Tabla");
	   btngenerar.setBounds(87, 265, 109, 23);
   }
   pack();
   this.setSize(521, 357);
  } catch (Exception e) {
      //add your error handling code here
   e.printStackTrace();
  }
 }

 public void AgregarAL(ActionListener action) {
  this.btnSalir.addActionListener(action);
  this.btngenerar.addActionListener(action);
  }
 
 public void SetResultadoBusquedaPosicionesEquipos (AbstractTableModel abstractablemodel){
		this.tblTablaPosiciones.setModel(abstractablemodel);
  }


}